<?php
/**
 * Created by JetBrains PhpStorm.
 * User: stolium
 * Date: 14.01.14
 * Time: 23:55
 * To change this template use File | Settings | File Templates.
 */
namespace Stolium\TestBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


class ClubType extends AbstractType{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', 'text')
            ->add('description', 'text')
            ->add('level', 'entity',  array(
                'class' => 'TestBundle:Level',
                'property' => 'title'
            ))
            ->add('save', 'submit');
    }

    public function getName()
    {
        return 'club';
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Stolium\TestBundle\Entity\Club',
        ));
    }

}